﻿<!DOCTYPE html> 
<html>
<head>
    <title></title>

    <script src="../../../../ClientGlobalContext.js.aspx" type="text/javascript"></script>

    <script type="text/javascript" src="../../../js/libraries/jquery.js"></script>
    <script type="text/javascript" src="../../../js/libraries/knockout.js"></script>

    <script type="text/javascript" src="../../../js/CrmSoapFacade.js"></script>
    <script type="text/javascript" src="../../../js/TuneMultiCheckBox.js"></script>
  
    <link type="text/css" href="../../../css/TuneMultiCheckBox/templates/default2013.css" rel="stylesheet" />


</head>
  <body>
    <div class="loadingImageContainer" data-bind="visible: DataLoaded() == false">
      <img alt="Loading..." src="/_imgs/AdvFind/progress.gif" />
    </div>
    <div class="container" style="display: none" data-bind="foreach: CheckboxItemSet, visible: DataLoaded()">
      <input data-bind="id: Id, checked: Value, title: Name, enable: $parent.GetIsEnabled()" type="checkbox"/>
      <label data-bind="for: Id, text: Name" > </label>
      <br/>        
    </div>
    
    <script type="text/javascript">
      crmjQuery(document).ready(function () {

        var vm = new window.TuneMultiCheckBox.ViewModel();
        vm.LoadData().then(
          function () {
            ko.applyBindings(vm);
          },

          function (error) {
            var message = "An error occured while bulding the checkboxset. Details:" + error.message + " Response:" + error.response + " Status: " + error.status;
            alert(message);
          }
        );
      });

    </script>
  </body>
</html>
